home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
assemblr
/
library
/
asmlib
/
multiwin.doc
< prev
next >
Wrap
Text File
|
1994-02-27
|
20KB
|
689 lines
************************ MULTI-WINDOW SUBSYSTEM ****************************
ASMLIB Multi-Window text mode video subroutines
Copyright (C) 1992, 1993 Douglas Herr ■ All rights reserved
ASMLIB's multi-window system allows several pop-up windows to be stored
at any given time, and permits any one window or any group of overlapping
or non-overlapping windows to be displayed on the screen in any position
and in any order. Pop-up windows may be created, printed to, cleared or
moved whether displayed or hidden. Up to 10 pop-up windows may be open at
any time. All MultiWindow subroutines assume DS:@data.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWBORDER: puts single- or double-lined border, or character border,
around an open window; sets border flag.
The Multi-Window border flag prevents MWClear, MWFill, MWPrint
and MWCenter from over-writing the border for the selected
window.
Source: mwborder.asm (multiwin.asm)
Call with: BX = window handle
AH = border color attribute
AL = border type: -1 = double line
0 = single line
1 through 254 = ASCII character
Returns: if CF = 0, no error
if CF = 1, handle not valid or window dimensions too small
Uses: flags
Example:
include asm.inc
extrn mwinit:proc, mwopen:proc, mwborder:proc
.data
whandle dw 0
wdata dw 0,0,19,39 ; 20 rows, 40 columns
.code
; program fragment assumes DS:@data
.
.
.
call mwinit
lea bx,wdata ; point to window corner data
call mwopen ; open window in multi-window system
jc problem ; if error, go take care of it
mov whandle,ax ; else save window handle
; give the window a single-lined border in red
mov bx,ax ; handle in BX
mov al,0
mov ah,12
call mwborder
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWCENTER: centers a string in selected window
Source: mwcenter.asm (mwprint.asm, multiwin.asm)
Call with: BX = window handle
DS:[SI] -> ASCIIZ string
DH = window row
AH = color attribute
Returns: DL = window column used by MWPrint
Uses: AL, DL, flags
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWCLEAR: clears a window managed by the MultiWindow system
source: mwclear.asm (multiwin.asm)
Call with: BX = window handle
AH = color attribute
if the window's border is enabled, it is not cleared
Returns: nothing
Uses: AX, flags
Example: see example for MWNoBorder
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWCLOSE: releases a window's memory buffer to DOS
Source: multiwin.asm
Call with: BX = valid window handle
assumes DS:@data
Returns: if CF = 0, no error
if CF = 1, bad handle
Uses: flags
Example:
include asm.inc
extrn mwtop:proc, mwclose:proc
.code
; program fragment assumes DS:@data
.
.
.
mov bx,window_handle
; all done with this window
; first I want to move it to the top of the window "stack"
; so the next window I open will be on top
call mwtop
; then get rid of it
call mwclose
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWCLOSEALL close all open windows, releasing buffers
Source: mwclose.asm (multiwin.asm)
Call with: no parameters
Returns: nothing
Uses: nothing; all registers and flags are saved
Example:
call mwcloseall
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWDEFAULT: change default status of opened windows
Source: mwdef.asm (multiwin.asm)
Call with: AL = option bits
bit 0 if zero, hide windows
if one, display window
bit 2 if zero, no shadow
if one, shadow enabled
MWDefault affects only windows opened AFTER MWDefault is called.
Does not change the status of previously-opened windows.
assumes DS:@data
Returns: nothing
Uses: AL
Example:
include asm.inc
extrn mwinit:proc, mwopen:proc
extrn mwdefault:proc
.code
; program fragment assumes DS:@data
.
.
.
call mwinit
mov al,101b ; all windows with shadow and unhidden
call mwdefault ; update defaults
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWDISPLAY: display open windows on the screen
Source: multiwin.asm
Call with: no parameters
MWDisplay updates the screen by displaying all unhidden
open windows. No windows will ever show up on the screen
if you don't call MWDisplay. You must call MWInit before
using MWDisplay.
Returns: nothing
Uses: nothing
Example: see example code for MWPrint
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWFILL: fills a window managed by the MultiWindow system
source: mwclear.asm (multiwin.asm)
Call with: BX = window handle
AH = color attribute
AL = character to fill window with
if the window's border is enabled, it is not cleared
Returns: nothing
Uses: AX, flags
Example: see example for MWNoBorder
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWHIDE: hide selected window
a "hidden" window is ignored by MWDISPLAY
Source: multiwin.asm
Call with: BX = window handle
Returns: if CF = 0, no error
if CF = 1, bad handle number
Uses: flags
Example:
include asm.inc
extrn mwinit:proc, mwopen:proc, mwhide:proc
.data
whandle dw 0
wdata dw 0,0,19,39 ; 20 rows, 40 columns
.code
; program fragment assumes DS:@data
.
.
.
call mwinit
lea bx,wdata ; point to window corner data
call mwopen ; open window in multi-window system
jc problem ; if error, go take care of it
mov whandle,ax ; else save window handle
mov bx,ax ; copy handle to AX
call mwhide ; don't display window when MWDisplay is called
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWHIDEALL: hide all open windows
Source: mwhide.asm (multiwin.asm)
Call with: no parameters
Returns: nothing
Uses: nothing
Example:
include asm.inc
extrn mwinit:proc, mwhideall:proc
extrn mwopen:proc, mwdisplay:proc
.code
call mwinit
; program opens several windows
.
.
.
; make all open windows disappear
call mwhideall
call mwdisplay
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWINIT: initializes multi-window system. Several pop-up windows may
be popped onto or removed from a base screen in any order.
You must re-initialize the multi-window system each time the
base screen changes. MWInit does not affect any open windows.
Source: multiwin.asm (screen.asm, smem.asm)
Call with: no parameters
assumes DS:@DATA
Returns: AX = segment address of saved base screen
Uses: AX
Example:
include asm.inc
extrn mwinit:proc
.code
; program fragment assumes DS:@data
.
.
call mwinit
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWNOBORDER: clears the border flag for the associated window
Source: mwborder.asm (multiwin.asm)
Call with: BX = window handle
Returns: if CF = 0, no error
if CF = 1, bad handle number
Uses: flags
Example:
include asm.inc
extrn mwinit:proc, mwopen:proc
extrn mwborder:proc, mwnoborder:proc
extrn mwclear:proc
.data
window_handle dw 0
wdata dw 0,0,19,39 ; 20 rows, 40 columns
.code
; program fragment assumes DS:@data
.
.
.
call mwinit
lea bx,wdata ; point to window corner data
call mwopen ; open window in multi-window system
jc problem ; if error, go take care of it
mov window_handle,ax ; else save window handle
; give the window a single-lined border in red
mov bx,ax ; handle in BX
mov al,0
mov ah,12
call mwborder
.
.
; some time later, I want to clear the ENTIRE window, including the border
mov bx,window_handle
call mwnoborder
mov ah,any_old_color
call mwclear
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWNOSHADOW: disables "shadow" effect for selected window
Source: mwshadow.asm (multiwin.asm)
Call with: BX = window handle
Returns: if CF = 0, no error
if CF = 1, bad handle number
Uses: flags
Example:
include asm.inc
extrn mwinit:proc, mwopen:proc, mwnoshadow:proc
.data
whandle dw 0
wdata dw 0,0,19,39 ; 20 rows, 40 columns
.code
; program fragment assumes DS:@data
.
.
.
call mwinit
lea bx,wdata ; point to window corner data
call mwopen ; open window in multi-window system
jc problem ; if error, go take care of it
mov whandle,ax ; else save window handle
mov bx,ax ; copy handle to AX
call mwnoshadow ; disable shadow for this window
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWOPEN: opens a pop-up window for subsequent display
Source: multiwin.asm (screen.asm, smem.asm)
Call with: DS:[BX] pointing to window corner data
assumes DS:@data
Up to 10 windows may be open at any time; if you need more,
you will need to change MWINDOW_COUNT in multiwin.asm and
re-assemble. If two or more windows overlap on the screen,
the one opened last will be displayed on top of the other(s).
The window appearing on top may be changed with MWTop.
Note the default status of all opened windows:
hidden
no shadow
no border
You may change the status of any open window with
MWUnHide, MWHide, MWShadow, MWNoShadow, MWBorder and MWNoBorder;
All open windows may be hidden or un-hidden with
MWHideAll or MWUnHideAll;
The default status of newly-opened windows may be changed
with MWDefault.
Returns: if CF = 0, AX = multi-window handle
if CF = 1, insufficient DOS memory for window
Uses: AX, flags
Example:
include asm.inc
extrn mwinit:proc, mwopen:proc
.data
whandle dw 0
wdata dw 0,0,19,39 ; 20 rows, 40 columns
; upper left corner of screen
.code
; program fragment assumes DS:@data
.
.
.
call mwinit
lea bx,wdata ; point to window corner data
call mwopen ; open window in multi-window system
jc problem ; if error, go take care of it
mov whandle,ax ; else save window handle
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWPRINT: print an ASCIIZ string to an open window
Source: mwprint.asm (multiwin.asm)
Call with: BX = window handle
DS:[SI] pointing to an ASCIIZ string
AH = color attribute
DH = window row, DL = window column
assumes DS:@data
Returns: nothing
Uses: AL
Example:
include asm.inc
extrn mwinit:proc, mwopen:proc
extrn mwprint:proc, mwdisplay:proc
.data
window_handle dw 0
wdata dw 0,0,19,39 ; 20 rows, 40 columns
row db 1
column db 1
color db 23
window_string db 'Print this in the window',0
.code
; program fragment assumes DS:@data
.
.
.
call mwinit
lea bx,wdata ; point to window corner data
call mwopen ; open window in multi-window system
jc problem ; if error, go take care of it
mov window_handle,ax ; else save window handle
lea si,window_string ; point to text
mov bx,ax ; AX is still the handle
mov dh,row ; offset from top of window
mov dl,column ; offset from left side of window
; ROW and COLUMN are relative to BORDER
; if border is enabled
mov ah,color
call mwprint
call mwdisplay ; show all unhidden windows on the screen
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWPRINTCE: prints a string in selected window & clears to edge of window
clears to border if the window's border is enabled
Source: mwprint.asm (multiwin.asm)
Call with: BX = window handle
DS:[SI] pointing to an ASCIIZ string
AH = color attribute
DH = window row, DL = window column
Returns: nothing
Uses: AL
Example: see MWPrint
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWSELECT: determines which window is visible at screen coordinate
Source: mwselect.asm (multiwin.asm)
Call with: DH = screen row, DL = screen column
Returns: if CF = 0, BX = handle of window visible at these coordinates
if CF = 1, no window visible at these coordinates
Uses: BX, flags
Example:
include asm.inc
extrn mwselect:proc, mwtop:proc
.code
; program fragment assumes DS:@data
.
.
.
; the mouse has been scurrying around the screen
; and the program has detected a mouse button press
; the mouse cursor is at row 3, column 14
; determine which window the mouse has landed on
mov dh,3
mov dl,14
call mwselect ; get window visible at (3,14)
jc no_window ; error? mouse must have had an itch
call mwtop ; put this window on top of all others
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWSHADOW: enables "shadow" effect for selected window
Source: mwshadow.asm (multiwin.asm)
Call with: BX = window handle
Returns: if CF = 0, no error
if CF = 1, bad handle
Uses: flags
Example:
include asm.inc
extrn mwinit:proc, mwopen:proc, mwshadow:proc
.data
whandle dw 0
wdata dw 0,0,19,39 ; 20 rows, 40 columns
.code
; program fragment assumes DS:@data
.
.
.
call mwinit
lea bx,wdata ; point to window corner data
call mwopen ; open window in multi-window system
jc problem ; if error, go take care of it
mov whandle,ax ; else save window handle
mov bx,ax ; copy handle to AX
call mwshadow ; enable shadow for this window
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWTITLE: center an ASCIIZ string at the top of an open window
Source: mwtitle.asm (mwcenter.asm, multiwin.asm)
Call with: BX = window handle
DS:[SI] pointing to an ASCIIZ string
AH = color attribute
assumes DS:@data
MWTitle prints the window title at the top of the window,
overwriting the border (if it is enabled).
Returns: nothing
Uses: AL
Example:
include asm.inc
extrn mwinit:proc, mwopen:proc
extrn mwtitle:proc, mwdisplay:proc
.data
window_handle dw 0
wdata dw 0,0,19,39 ; 20 rows, 40 columns
row db 1
column db 1
color db 23
window_string db 'Window Title',0
.code
; program fragment assumes DS:@data
.
.
.
call mwinit
lea bx,wdata ; point to window corner data
call mwopen ; open window in multi-window system
jc problem ; if error, go take care of it
mov window_handle,ax ; else save window handle
lea si,window_string ; point to text
mov bx,ax ; AX is still the handle
mov ah,color
call mwtitle
call mwdisplay ; show all unhidden windows on the screen
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWTOP: displays selected window on top of all others
Source: mwtop.asm (multiwin.asm)
Call with: BX = window handle
Returns: DF = 0
if CF = 0, no error
if CF = 1, bad handle number
Uses: flags
Example:
include asm.inc
extrn mwselect:proc, mwtop:proc
.code
; program fragment assumes DS:@data
.
.
.
; the mouse has been scurrying around the screen
; and the program has detected a mouse button press
; the mouse cursor is at row 3, column 14
; determine which window the mouse has landed on
mov dh,3
mov dl,14
call mwselect ; get window visible at (3,14)
jc no_window ; error? mouse must have had an itch
call mwtop ; put this window on top of all others
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWUNHIDE: allow selected window to be displayed
Source: multiwin.asm
Call with: BX = window handle
Returns: if CF = 0, no error
if CF = 1, bad handle number
Uses: flags
Example:
include asm.inc
extrn mwinit:proc, mwopen:proc, mwunhide:proc
.data
whandle dw 0
wdata dw 0,0,19,39 ; 20 rows, 40 columns
.code
; program fragment assumes DS:@data
.
.
.
call mwinit
lea bx,wdata ; point to window corner data
call mwopen ; open window in multi-window system
jc problem ; if error, go take care of it
mov whandle,ax ; else save window handle
mov bx,ax ; copy handle to AX
call mwunhide ; display window when MWDisplay is called
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
MWUNHIDEALL: unhide all open windows
Source: mwunhide.asm (multiwin.asm)
Call with: no parameters
Returns: nothing
Uses: nothing
Example:
include asm.inc
extrn mwinit:proc, mwunhideall:proc
extrn mwopen:proc, mwdisplay:proc
.code
call mwinit
; program opens several windows
.
.
.
; make all open windows visible
call mwunhideall
call mwdisplay